1. Field
The present embodiments relate to techniques for analyzing code coverage during software testing. More specifically, the present embodiments relate to a method and system for dividing complex instructions into sub-instruction blocks and using the sub-instruction blocks in place of the complex instructions during code coverage analysis.
2. Related Art
Test suites are typically used to test a software program for conformity to a specified set of behaviors or requirements. In particular, a test suite may include a set of test cases, each of which tests a different requirement or specification for the software program. For example, a test suite for determining the correctness of an image decoder may supply a set of images to the image decoder. After processing each image, the output of the image decoder may be analyzed to determine if the image decoder is working correctly.
In addition, a test suite may be created to maximize code coverage of the software program. In other words, the collection of test cases in the test suite may be designed to test as much of the software program as possible. As a result, the selection of inputs for use in test suites may greatly affect the resulting code coverage provided by the test suites. For example, a wide variety of images may be used in a test suite to exercise different features of an image decoder during testing.
However, conventional techniques for selecting inputs to be used in test suites have a number of drawbacks. First, input selection for test suite generation is often accomplished manually. For example, an engineer may generate a test suite for a video decoder by manually browsing through a collection of video files and selecting a subset of the video files that are likely to test a variety of different features in the video decoder. However, manually selecting inputs for software testing is often tedious and leads to an incomplete set of inputs. For example, an engineer may have difficulty selecting a subset of a large number of inputs that provides maximal coverage of a software program.
On the other hand, employing a “brute force” approach that attempts to maximize coverage of the software program by supplying an extremely large set of inputs to the software program may be impractical or inefficient. For example, using the set of images available on the Internet to test an image decoder may be infeasible and unnecessary.
Moreover, coverage analysis of the software program may not be fine-grained enough to facilitate the generation of test suites that exercise all parts of the software program. For example, a conditional branch associated with a complex comparison may not be taken unless a specific input is provided. As a result, test suites are unlikely to cover the conditional branch, even with large numbers of inputs.
Hence, what is needed is a technique for selecting inputs for use in test suites that both efficiently and thoroughly tests the software program.